package com.drojian.demo1.test2;

import android.os.Bundle;
import android.widget.Button;
import android.widget.RatingBar;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;

import com.drojian.demo.R;

public class RatingBarActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.ui2_activity_rating_bar);

        Button back = findViewById(R.id.back);
        back.setOnClickListener(v->finish());

        RatingBar ratingBar = findViewById(R.id.ratingBar);
        ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
                Toast.makeText(getApplicationContext(),"您的评分为"+ratingBar.getRating()+"颗星",Toast.LENGTH_SHORT).show();
                Toast toast = new Toast(RatingBarActivity.this);
                //toast.set
            }
        });
    }
}